1bashThis demonstrates using grep to filter lines based on a regular expression.grep "^foo.*bar$" file.txtexternal toolsgrepregex filter (regular expression filter)
2bashThis demonstrates using egrep to recursively search for lines containing either foo or bar within the /baz directory.egrep 'foo|bar' /baz -Rexternal toolsgrepregex filter (regular expression filter)multi-pattern search with recursion
3bashThis demonstrates using grep with extended regular expressions to search for patterns in a file, though the -R option is incorrectly applied.grep --extended-regexp|-E 'foo|bar' /baz -Rexternal toolsgrepregex filter (regular expression filter)extended regular expressions
4bashThis demonstrates searching for multiple patterns (foo or bar) in files within the /baz directory recursively using grep.grep 'foo\|bar' /baz -Rexternal toolsgrepregex filter (regular expression filter)multiple patterns